@import url("http://fonts.googleapis.com/css?family=Lato");

/*定义变量*/
:root {
  --background: #9b59b6;
  --tab-base-color: #8e44ad;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/*body区域整体定义基础样式*/
body {
  padding: 20px;
  text-align: left;
  font-family: Lato;
  color: #fff;
  background: var(--background);
}

/*h1用了浮动*/
h1 {
  font-weight: normal;
  font-size: 40px;
  text-transform: uppercase;
  float: left;
  /*这里下margin设置没啥意义，改为0也行，因为整体浮动了*/
  margin: 20px 0 100px 10px;
  /*span用了block能另起一行*/
  span {
    font-size: 13px;
    display: block;
    padding-left: 4px;
  }
}

.tabs {
  width: 650px;
  list-style: none;   /* 移除列表项前的标记（如圆点） */
  float: none; /*h1是浮动的，.tabs不是*/
  position: relative; /*ul设置relative，它里面包含内容的div是绝对定位，方便控制div的位置*/
  margin: 80px 0 0 10px;
  text-align: left;
  li {
    float: left;
    display: block;
  }
  input[type="radio"] {
    position: absolute;
    top: 0;
    left: -9999px;
  }
  label {
    display: block;
    padding: 14px 21px;
    border-radius: 2px 2px 0 0;
    font-size: 20px;
    font-weight: normal;
    text-transform: uppercase;
    background: var(--tab-base-color);
    cursor: pointer;
    position: relative;
    top: 4px;
    transition: all 0.2s ease-in-out;
  }
  label:hover {
    filter: brightness(90%);  
  }

  .tab-content {
    z-index: 2;
    display: none;
    overflow: hidden;
    width: 100%;
    font-size: 17px;
    line-height: 25px;
    padding: 25px;
    position: absolute;
    top: 53px; /*div内容部分通过绝对定位top参数控制和label的位置*/
    left: 0;
    background: var(--tab-base-color);
    filter: brightness(85%);
  }

  [id^="tab"]:checked + label {
    top: 0;
    padding-top: 17px;
    filter: brightness(85%);  
  }

  [id^="tab"]:checked ~ [id^="tab-content"] {
    display: block;
  }
}

p.link {
  clear: both;
  margin: 380px 0 0 15px;
  a {
    display: block;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
    color: #fff;
    padding: 5px 10px;
    margin: 0 5px;
    background-color: var(--tabs-base-color);
    transition: all 0.2s ease-in;
    filter: brightness(90%);
  }
  a:hover {
    filter: brightness(30%);
  }
} 